package demo02_FactoryMethod;

import demo02_FactoryMethod.factory.Factory;

public class FactoryMethodUtil {
    private static final String a = "demo02_FactoryMethod.factory.%s";
    private static final String factoryext = "Factory";
    static public Factory getBean(String ext) throws Exception {
        String className = String.format(a, ext.toUpperCase() + factoryext);
        Class clazz = Class.forName(className);
        Object o = clazz.newInstance();
        return (Factory) o;
    }
}
